
using System;
using LastFMGenNHibernate.EN.LastFM;
using LastFMGen_LastFMWCF.DTO.LastFM;

namespace LastFMGen_LastFMWCF.AdaptersEN.LastFM
{
        public class ComentarioDTOENAdapter {
        public static ComentarioEN Convert (ComentarioDTO dto)
        {
                ComentarioEN newinstance = null;

                try
                {
                        if (dto != null) {
                                newinstance = new ComentarioEN ();



                                newinstance.Id = dto.Id;
                                newinstance.Comment = dto.Comment;
                                if (dto.Evento_oid != -1) {
                                        LastFMGenNHibernate.CAD.LastFM.IEventoCAD eventoCAD = new LastFMGenNHibernate.CAD.LastFM.EventoCAD ();

                                        newinstance.Evento = eventoCAD.ReadOIDDefault (dto.Evento_oid);
                                }
                                if (dto.Cancion_oid != -1) {
                                        LastFMGenNHibernate.CAD.LastFM.ICancionCAD cancionCAD = new LastFMGenNHibernate.CAD.LastFM.CancionCAD ();

                                        newinstance.Cancion = cancionCAD.ReadOIDDefault (dto.Cancion_oid);
                                }
                        }
                }
                catch (Exception ex)
                {
                        throw ex;
                }
                return newinstance;
        }
        }
}
